from codex import * import random from time import sleep delay = 1 display.draw_text("Roll Dice", scale=3, x=35, y=80) display.draw_text("Program", scale=3, x=35, y=120) display.draw_text("Press A to roll", scale = 2, x=35, y=170) display.draw_text("Press B to quit", scale = 2, x=35, y=185) sleep(delay) dice = [ "1", "2", "3", "4", "5", "6" ] while True: if buttons.was_pressed(BTN_A): display.clear() display.draw_text("Rolling...", scale=2, y=30) sleep(delay) display.clear() display.draw_text(random.choice(dice), color=BLUE, scale=20, x=50, y=50) sleep(delay) display.clear() display.draw_text("Press A to roll", scale = 2, x=35, y=170) display.draw_text("Press B to quit", scale = 2, x=35, y=185) if buttons.was_pressed(BTN_B): display.clear() display.print("Finished")